<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>登录注册</title>
    <%--<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css">--%>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/normalize.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/userloginstyle.css">



<script>
    function a1() {
        $.get({
            url:"${pageContext.request.contextPath }/user/a3",
            data:{"name":$("#name").val()},
            success:function (data) {
                if (data.toString()==='ok') {
                    $("#user").css("color","green");
                    $("#user").html("用户名可用");
                    document.getElementById("bt1").disabled = false
                }else {
                    $("#user").css("color","red");
                    $("#user").html("用户名不可用");
                    document.getElementById("bt1").disabled = true
                }


            }

        })

    }

</script>





</head>
<body>

<!-- partial:index.partial.html -->
<div class="container right-panel-active">
    <!-- Sign Up -->
    <div class="container__form container--signup">
        <form action="${pageContext.request.contextPath}/user/selectUsers" class="form" method="post">
            <h2 class="form__title">登录</h2>
            <div><input type="text" name="name" placeholder="用户名" class="input" required="required"/></div>
            <div><input type="password" name="password" placeholder="密码" class="input" required="required"/></div>
            <div><a href="${pageContext.request.contextPath}/skip/updatePassword" class="link">忘记密码</a></div>
            <div><input type="submit" class="btn" value="登录"></div>
            <span style="color: red;font-weight: bold">${error}</span>
            <%--<button class="btn">登录</button>--%>
        </form>

    </div>

    <!-- Sign In -->
    <div class="container__form container--signin">
        <form action="${pageContext.request.contextPath}/user/addUser" class="form" method="post">
            <h2 class="form__title">注册</h2>
            <input type="text" name="name" placeholder="用户名" class="input" id="name" onblur="a1()" required="required"/>
            <span id="user"></span>
            <input type="email" name="email" placeholder="邮箱" class="input" required="required"/>
            <input type="password" name="password" placeholder="密码" class="input" required="required"/>
            <%--<button class="btn">注册</button>--%>
            <div><input type="submit" class="btn" value="注册" id="bt1" disabled="disabled"></div>
        </form>
    </div>

    <!-- Overlay -->
    <div class="container__overlay">
        <div class="overlay">
            <div class="overlay__panel overlay--left">
                <button class="btn" id="signIn">注册</button>
            </div>
            <div class="overlay__panel overlay--right">
                <button class="btn" id="signUp">登录</button>
            </div>
        </div>
    </div>
</div>
<!-- partial -->
<script type="text/javascript" src="${pageContext.request.contextPath }/js/script.js"></script>

<script src="${pageContext.request.contextPath }/js/jquery-3.6.0.js"></script>
</body>
</html>
